using System.Linq;
using SapaFinance.Domain.Model;
using SapaFinance.GenericRepository;

namespace SapaFinance.Domain
{
    public interface IUserSpecification : ISpecification<User>
    {
        IUserSpecification WithLogin(string login);

    }

    public class UserQueryableSpecification
     : QueryableSpecification<User>
       , IUserSpecification
    {

        public UserQueryableSpecification(IUnitOfWorkConvertor unitOfWorkConvertor)
            : base(unitOfWorkConvertor)
        {
        }

        public IUserSpecification WithLogin(string login)
        {
            this.Queryable = this.Queryable.Where(c => c.Login == login);
            return this;
        }

    }
}